<template>
  <el-container>
    <el-header><h2>宏烨找房后台管理系统</h2></el-header>
    <el-container>
      <el-aside width="200px">
        <el-radio-group v-model="isCollapse" style="margin-bottom: 20px">
          <el-radio-button :label="false">展开</el-radio-button>
          <el-radio-button :label="true">收起</el-radio-button>
        </el-radio-group>
        <el-menu
          default-active="1-4-1"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
          :collapse="isCollapse"
          router
        >
          <el-menu-item :index="v.path" v-for="(v,i) in arr" :key="i">
            <i class="el-icon-menu"></i>
            <span slot="title">{{v.title}}</span>
          </el-menu-item>
        </el-menu>
      </el-aside>

      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import getAuth from "../../auth/getAuth";
export default {
  data() {
    return {
      arr: [],
      isCollapse: true,
    };
  },
  created() {
    this.arr = getAuth();
    console.log(this.arr);
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
  },
};
</script>

<style>
.el-header,
.el-footer {
  background-color: skyblue;
  color: #fff;
  line-height: 60px;
}

.el-aside {
  color: #333;
  display: flex;
  flex-direction: column;
  line-height: 50px;
}
.el-aside a {
  color: #ccc;
  text-decoration: none;
}

.el-main {
  /* background-color: #ccc; */
  color: #333;
  padding: 8px;
}

body > .el-container {
  margin-bottom: 40px;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}
.el-radio-button{
  margin: 0 13px;
}
.el-menu{
  background: black;
}
.el-menu-item{
   color: #fff;
}
</style>